<%@page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<title>功能授权</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style>
<base target="_self"/>
	</head>
<jsp:include page="../common/init.jsp"></jsp:include>
<%
 response.setHeader("Pragma", "No-cache");
 response.setHeader("Cache-Control", "no-cache");
 response.setDateHeader("Expires", 0);
%>
<script type="text/javascript">
//设置条件
var indexNum＝0;
function selCondition(num,xzbh)
{
    indexNum=num;
    var action="<%=request.getContextPath() %>/qxgl/selCondition.do?tempid=" 
    + Math.random()+"&xzbh="+xzbh+"&qxbh=<s:property value="qxbh"/>";
    win = window.showModalDialog(action,null,'dialogHeight=520px;dialogWidth=310px;status=no;scroll=no;help=no');
    callback(win);
	//openWindow=window.open(action, "newwin", "height=450, width=300,toolbar=no,top=100,left=100,scrollbars=no,menubar=no");
}
function callback(rValue){
	if(rValue!=null)
	{
		con=rValue;
		document.getElementById("xztj_"+indexNum).value=con[0];
		document.getElementById("xstj_"+indexNum).value=con[1];
	}
}
//产生日历框
  var cdr = new Calendar("cdr");
  document.write(cdr);
  cdr.showMoreDay = true;
//提交;
function doSubmit()
{
		document.forms[0].action="changeAllYmgnRight.do";
		document.forms[0].submit();
}
//按钮选择
function checkBut(parentName,obj,checkFlag)
{
    
    if(checkFlag==0)
    {
        for(i=0;i<document.forms[0].elements.length;i++) 
		{
		    if(document.forms[0].elements[i].type == "checkbox"
		    &&(document.forms[0].elements[i].id+"").indexOf(parentName+"_")>-1)
		    {
		      document.forms[0].elements[i].checked=obj.checked;
		    }
		} 
    }
    else if(checkFlag==1)
    {
        var childNum = 0;
        var checkNnum = 0;
	    if(obj.checked)
	    {
	       document.getElementById(parentName).checked=obj.checked
	    }
	    else
	    {
	        for(i=0;i<document.forms[0].elements.length;i++) 
			{
		      	if(document.forms[0].elements[i].type == "checkbox"
		          &&(document.forms[0].elements[i].id+"").indexOf(parentName+"_")>-1)
		    	{
			      childNum++;
			      if(!document.forms[0].elements[i].checked)
			      {
			        checkNnum++;
			      }
			    }
			    
			}
			if(childNum==checkNnum)
			{
			   document.getElementById(parentName).checked=obj.checked
			}
		}
    }
}
//提示信息
function showMessage(){
	var message="<%=request.getAttribute("info")%>";
	if(message != "null" && message != ""){
		document.getElementById('errorDivCreateWzbm').innerHTML='提示:<span style="font-size:12px;color:#ff0000">' + message + '</span>';
		document.getElementById('errorDivCreateWzbm').style.display="inline";
		document.getElementById('errorDivCreateWzbm').focus();
	}
}
mpmenu1=new mMenu(' 保 存 ','doSubmit()','script','<%=request.getContextPath() %>/images/img_ht_wz_8.gif','62','24','2','100','2');
mpmenu2=new mMenu(' 关 闭 ','window.close()','script','<%=request.getContextPath() %>/images/img_ht_wz_8.gif','62','24','2','100','2');
</script>
<body onload="showMessage()" onclick="javascript: mouseClick('errorDivCreateWzbm');">
		<s:form action="">
		<table cellspacing="0" cellpadding="0" class="main_tab1">
   <!-- 
    <tr>
        <td rowspan="4" class="main_tab1_td8">&nbsp;</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_28.gif" alt="left" /></td>
        <td class="main_tab1_td2">
		</td>
        <td class="main_tab1_td1"><img src="<%=request.getContextPath() %>/images/img_ht_wz_32.gif" alt="right" /></td>
    </tr>
     -->
    <tr>
        <td colspan="3" class="main_tab1_td3">
		<div id="mainbg">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="main_tab3">
		<tr valign="bottom" height="25">
		<td height="25" colspan="4" align="left" valign="bottom" class="r_tab_c_4">
		<div id="errorDivCreateWzbm"></div>
		<s:hidden name="qxbh"></s:hidden>
		<s:hidden name="ymbhs"></s:hidden>
		</td>
		</tr>
	<s:if test="appsysYmgnBeanList.size>0">
		<tr valign="bottom" height="30">
		<td height="35" colspan="4" align="left" valign="bottom"
				class="r_tab_c_4">
			<strong>功能按钮：</strong>
			</td>
		</tr>
		<tr valign="bottom" height="30">
			<td height="35" colspan="4" align="left" valign="bottom"
				class="r_tab_c_4">
				<s:set name="childernList" value="appsysYmgnBeanList"></s:set>
				<s:set name="childNum" value="0"></s:set>
				<s:set name="childSjbh" value="-1"></s:set>
				<s:iterator value="appsysYmgnBeanList" status="index">
				<s:if test="sjbh==-1">
				<input id="but_<s:property value="gnbh"/>" type="checkbox" onclick="checkBut('but_<s:property value="gnbh"/>',this,0);" name="gnbhs" value="<s:property value="gnbh"/>,<s:property value="qxbz"/>" <s:if test="flag>-1">checked="checked"</s:if>>
				&nbsp;<s:property value="gnmc"/>&nbsp;
				<s:set name="childSjbh" value="gnbh"></s:set>
				<s:set name="childNum" value="0"></s:set>
				<s:iterator value="#childernList" status="cIndex">
				<s:if test="sjbh==#childSjbh">
				<s:if test="#childNum==0">
				<br>
				</s:if>
				<s:if test="#childNum%6==0">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;●
				</s:if>
				<input id="but_<s:property value="sjbh"/>_<s:property value="gnbh"/>" type="checkbox" onclick="checkBut('but_<s:property value="sjbh"/>',this,1);" name="gnbhs" value="<s:property value="gnbh"/>,<s:property value="qxbz"/>" <s:if test="flag>-1">checked="checked"</s:if>>
				&nbsp;<s:property value="gnmc"/>&nbsp;
				
				<s:if test="(#childNum+1)%6==0">
				<br>
				</s:if>
				<s:set name="childNum" value="#childNum+1"></s:set>
				</s:if>
				<s:if test="#childNum!=0&&#cIndex.index==(#childernList.size-1)">
				<br>
				</s:if>
				</s:iterator>
				</s:if>
				</s:iterator>
			</td>
		</tr>
		</s:if>
		<s:if test="xzzdList.size>0">
		<tr valign="bottom" height="30">
		<td height="35" colspan="4" align="left" valign="bottom"
				class="r_tab_c_4">
			<strong>限制字段：</strong>
			</td>
		</tr>
		
		<tr valign="bottom" height="30">
			<td height="35" align="left" valign="bottom"
				class="r_tab_c_4" colspan="4">
				<s:iterator value="xzzdList" status="index">
				<input type="checkbox" name="gnbhs" value="<s:property value="gnbh"/>,<s:property value="qxbz"/>" <s:if test="flag>-1">checked="checked"</s:if>>&nbsp;<s:property value="gnmc"/>&nbsp;
				<s:if test="(#index.index+1)%4==0">
					<br>
				</s:if>
				</s:iterator>
			</td>
		</tr>
		</s:if>
		<s:if test="fwjlList.size>0">
		<tr valign="bottom" height="30">
		<td height="35" colspan="4" align="left" valign="bottom"
				class="r_tab_c_4">
			<strong>数据范围：</strong>
			</td>
		</tr>
		<tr>
		<td colspan="4">
		<div style="overflow:scroll;height:190px;">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="main_tab2">
		<tr>
		<th align="center">
		编号
		</th>
		<th align="center">
		条件名称
		</th>
		<th align="center">
		条件内容
		</th>
		</tr>
	</s:if>
    <s:set name="cssClass"  value="'main_tab2_td1'"></s:set>
	<s:iterator value="fwjlList" status="index">
	<s:if test="#index.index%2==0">
	<s:set name="cssClass"  value="'main_tab2_td1'"></s:set>
	</s:if>
	<s:else>
	<s:set name="cssClass"  value="'main_tab2_td2'"></s:set>
	</s:else>
	<tr valign="bottom" height="25" class="<s:property value="#cssClass"/>">
		<td align="center" >
		<s:property value="#index.index+1"/>
		</td>
		<td align="left" >
		<s:property value="zdmc"/>
		<input type="hidden" name="qxfwjlgxs[<s:property value="#index.index"/>].ymbh" value="<s:property value="ymbh"/>">
		<input type="hidden" name="qxfwjlgxs[<s:property value="#index.index"/>].zdywmc" value="<s:property value="zdywmc"/>">
		<input type="hidden" name="qxfwjlgxs[<s:property value="#index.index"/>].xzbh" value="<s:property value="xzbh"/>">
		<input type="hidden" name="qxfwjlgxs[<s:property value="#index.index"/>].sjlx" value="<s:property value="sjlx"/>">
		</td>
		<s:if test="sjlx==1">
		<td align="left"  colspan="2">
			起止日期：<input type="text"  title="点击日历选择日期" value="<s:property value="xstj"/>" size="8" onKeyUp="inPutDay(this)" onBlur="checkDayIsValid(this);" onclick="cdr.show(this,getObjById('xstj_<s:property value="#index.index"/>'));" id="xstj_<s:property value="#index.index"/>" name="qxfwjlgxs[<s:property value="#index.index"/>].xstj" class="pale date"/>
 			<img align="absMiddle" id="mm_bbcPos" name="mm_bbcPos" style="cursor:hand;" src="<%=request.getContextPath() %>/images/calendar.gif" width="21" height="21" onMouseUp="cdr.show(this,getObjById('xstj_<s:property value="#index.index"/>'))" >
 			截至日期：<input type="text"  title="点击日历选择日期" value="<s:property value="xztj"/>" size="8" onKeyUp="inPutDay(this)" onBlur="checkDayIsValid(this);" onclick="cdr.show(this,getObjById('xztj_<s:property value="#index.index"/>'));" id="xztj_<s:property value="#index.index"/>" name="qxfwjlgxs[<s:property value="#index.index"/>].xztj" class="pale date"/>
 			<img align="absMiddle" id="mm_bbcPos" name="mm_bbcPos" style="cursor:hand;" src="<%=request.getContextPath() %>/images/calendar.gif" width="21" height="21" onMouseUp="cdr.show(this,getObjById('xztj_<s:property value="#index.index"/>'))" >
		</td>
		</s:if>
		<s:else>
		<td align="left" >
		<input type="text" id="xstj_<s:property value="#index.index"/>"  readonly="readOnly" name="qxfwjlgxs[<s:property value="#index.index"/>].xstj" value="<s:property value="xstj"/>" size="40" maxlength="80">
		&nbsp;
		<a href="javascript:void(0)" onfocus="this.blur()" >
		<img src="<%=request.getContextPath() %>/images/img_ht_wz_82.gif" border="0"  onclick="selCondition(<s:property value="#index.index"/>,'<s:property value="xzbh"/>');" ></a>
		<input type="hidden" id="xztj_<s:property value="#index.index"/>" name="qxfwjlgxs[<s:property value="#index.index"/>].xztj" value="<s:property value="xztj"/>">
		</td>
		</s:else>
	</tr>
 </s:iterator>
<s:if test="fwjlList.size>0">
  </table>
 </div>
 </s:if>						
		<s:if test="appsysYmgnBeanList.size>0||xzzdList.size>0||fwjlList.size>0">
		<tr valign="bottom" height="30">
			<td height="35" colspan="4" align="right" valign="middle"
				class="r_tab_c_4">
				<div id="funbut">
				<SCRIPT>document.write(mwritetodocument());</SCRIPT>
				</div>
			</td>
		</tr>
		</s:if>
			</table>
			</div>
</td>
    </tr>
    <tr>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_65.gif" alt="left" /></td>
        <td class="main_tab1_td5"></td>
        <td class="main_tab1_td4"><img src="<%=request.getContextPath() %>/images/img_ht_wz_67.gif" alt="right" /></td>
    </tr>
    <tr>
        <td colspan="3" class="main_tab1_td7">&nbsp;</td>
    </tr>
</table>
</s:form>
</body>
</html>